package com.wy.system.custom;

import com.wy.common.utils.MD5;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 密码处理
 * </p>
 *
 */
//自定义密码组件
@Component
public class CustomMd5Password implements PasswordEncoder {

  public String encode(CharSequence rawPassword) {
    return MD5.encrypt(rawPassword.toString());
  }

  public boolean matches(CharSequence rawPassword, String encodedPassword) {
    return encodedPassword.equals(MD5.encrypt(rawPassword.toString()));
  }
}
